package com.wanxi.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;


/**
 * @author Li
 * @Date 2023/4/25 16:22
 */
@WebServlet("/a")
public class TestServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
      req.setCharacterEncoding(StandardCharsets.UTF_8.toString());
//        String method = req.getMethod();
//        System.out.println(method);
//        System.out.println(req.getContextPath());
//        System.out.println(req.getRequestURL());
//        System.out.println(req.getRequestURI());
//        System.out.println(req.getQueryString());
//        System.out.println("=================");
 String username = req.getParameter("username");
        System.out.println(username);
 String password = req.getParameter("password");
 req.getRequestDispatcher("/index.jsp").forward(req,resp);
    }
}
